package com.itheima.tlias84.mapper;

import com.itheima.tlias84.annotaion.ReportLog;
import com.itheima.tlias84.dto.SelectClazzDTO;
import com.itheima.tlias84.dto.SelectClazzDetailDTO;
import com.itheima.tlias84.dto.SelectClazzIDDTO;
import com.itheima.tlias84.po.InsertClazzParam;
import com.itheima.tlias84.po.SelectClazzPageParam;
import com.itheima.tlias84.po.UpdateClazzParam;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClazzMapper {

  @ReportLog
    //添加班级
    @Insert("insert into Clazz (name,room,begin_date,end_date,master_id,subject) values (#{in.name}" +
            ",#{in.room},#{in.beginDate},#{in.endDate},#{in.masterId},#{in.subject}) ")
    int insertClazz(@Param("in")InsertClazzParam insertClazzParam);

    //分页查询班级
    List<SelectClazzDetailDTO> selectClazzDetailDTO(@Param("se")SelectClazzPageParam selectClazzPageParam);


    //查询所有班级list
    List<SelectClazzDTO> selectClazzList();
    @ReportLog
    //删除班级
    @Delete("delete from clazz where id = #{ids}")
    int deleteClazzById(@Param("ids") Integer ids);

     @ReportLog
    //更新班级
    int updateClazzById(@Param("u")UpdateClazzParam updateClazzParam);

    //通过id查询班级
    @Select("select name,room,begin_date,end_date,subject,create_time,update_time from clazz where id=#{id}")
    SelectClazzIDDTO selectClazzIDDTO(@Param("id") Integer id);


}
